require.config({
    baseUrl: "../Details_Modules",
    paths: {
        jq: "../libs/jquery",
        ajax: "../libs/ajax",
        GetData: "../modules/GetData",
        render: "Render_Details",
        setLocal:"Details_SetLocal",
        Magnifier:"Details_Magnifier",
    }
})

require(["jq", "ajax", "GetData", "render","setLocal","Magnifier"], function (_, ajax, GetData, render,setLocal,Magnifier) {
    
    const url = "http://localhost:3000/api1?type=getGoods";

    const id = location.search.split("=")[1];
    // console.log(id);

    GetData(url).then((res) => {
        console.log(res);
        let i = 0;
        res.some((val, idx) => {
            i = idx;
            return val.proId === id;
        })

        /* 点击加入购物车 */
        $(".J_LinkBasket").click(function () {
            setLocal($(this),res[i].price)
        })

    /* 渲染 */
        render(res[i]);

    /* 放大镜 */
        Magnifier(res[i])
    })
})